﻿//idea borrowed from http://thekindofme.wordpress.com/2009/01/12/ajax-enabling-mvccontrib-grid-pagination-with-jquery
var AJAX_GRID_PAGING_CLASS = "AjaxGridPaging";
var PAGINATION_RIGHT_CLASS = "paginationRight";

$(document).ready(function() {
    $("." + AJAX_GRID_PAGING_CLASS).each(function() {
        var gridDivId = "#" + this.id;
        var links = $(gridDivId).find("." + PAGINATION_RIGHT_CLASS).find("a");
        links.live("click", function(event) {
            event.preventDefault();
            var gridDivId = $(this).parents("." + AJAX_GRID_PAGING_CLASS)[0].id;
            $("#" + gridDivId).load(this.href, { search: $("#Search" + gridDivId).find("#Search").val() });
        });
    });
});
